package com.harveyh.cemax.config;

import java.util.ArrayList;
import android.content.Context;
import android.content.SharedPreferences;

public class Preferences {

	private Context context;
	SharedPreferences settings;
	SharedPreferences.Editor editor;
	private String DB_NAME = "cemax";
	private static Preferences instance;

	public static Preferences getInstance(Context context) {
		if (instance == null)
			instance = new Preferences(context);
		return instance;
	}

	private Preferences(Context context) {
		this.context = context;
		settings = this.context.getSharedPreferences(DB_NAME, 0);
		editor = settings.edit();
	}


	/** 设置Uid */
	public void setUID(String uid) {
		if(settings.contains("UID")){
			editor.remove("UID");
		}
		editor.putString("UID", uid);
		editor.commit();
	}

	/** 获取Uid */
	public String getUID() {
		return settings.getString("UID", "");
	}
	/** 设置最后一次阅读的题目信息*/
	public void setLastReadTimuInfo(String lastReadTimuInfo) {
		editor.putString("lastReadTimuInfo", lastReadTimuInfo);
		editor.commit();
	}
	/** 获取最后一次阅读的题目信息*/
	public String getLastReadTimuInfo() {
		return settings.getString("lastReadTimuInfo", "");
	}
}
